fix: add REQUIRED markers to all tool inputSchemas for GPT-5/OpenAI function calling#482
Open
pollmap wants to merge 2 commits intoGitlawb:mainfrom
Open
fix: add REQUIRED markers to all tool inputSchemas for GPT-5/OpenAI function calling#482pollmap wants to merge 2 commits intoGitlawb:mainfrom
pollmap wants to merge 2 commits intoGitlawb:mainfrom
Conversation
When using OpenClaude with GPT-5/Codex backends, slash commands such as
/skill-name trigger a Skill tool call without the required `skill` parameter,
resulting in: "The required parameter `skill` is missing".
Root cause: OpenAI function calling relies heavily on schema descriptions to
infer parameter values. The previous description did not make the
slash-to-parameter mapping explicit, causing GPT-5 to call Skill({}) or
Skill({skill: undefined}) instead of Skill({skill: "skill-name"}).
Changes:
- inputSchema: expand `skill` description to explicitly document that the
leading slash must be stripped (/commit → skill: "commit") with concrete
input/output examples for GPT-style function calling
- validateInput: add a null/undefined guard before skill.trim() to produce
an actionable error message when non-Claude runtimes omit the parameter
- prompt.ts: append a short IMPORTANT block for OpenAI/GPT function calling
that reinforces the required parameter contract and slash-stripping rule
Affected provider: OpenAI-compatible / Codex backends only.
Claude (Anthropic) behaviour is unchanged.
kevincodex1
previously approved these changes
Apr 7, 2026
Contributor
kevincodex1
left a comment
There was a problem hiding this comment.
Looks great to me! We just need to make sure this will not affect other models
gnanam1990
requested changes
Apr 7, 2026
Collaborator
gnanam1990
left a comment
There was a problem hiding this comment.
Thanks for the PR and for digging into this. The direction looks right, and the prompt/schema improvements seem helpful for GPT-style function calling. I do have one blocking concern before we merge:
- The missing-
skillruntime path still doesn’t appear to be fully handled.tool.inputSchema.safeParse(input)runs beforevalidateInput(), so calls likeSkill({})orSkill({ skill: undefined })will still fail in Zod first and never reach the new null/undefined guard. - There isn’t a regression test covering that exact missing-parameter path, so it’s hard to verify the reported issue is actually fixed rather than just better-guided.
Could you take another look and either adjust the schema/validation flow for that case, or narrow the PR description to “improve model guidance” and add a regression test for the actual failure mode? Happy to discuss if helpful.
… calling Extend the GPT-5 compatibility fix from SkillTool to all other tools. GPT-5 function calling relies heavily on description fields to decide whether to pass a parameter. Without explicit REQUIRED markers and concrete examples, GPT-5 omits required string parameters, causing InputValidationError across Agent, Bash, FileRead, FileEdit, Glob, Grep, WebFetch, WebSearch, and FileWrite tools. Changes per tool: - AgentTool: description + prompt → REQUIRED with examples - BashTool: command → REQUIRED with examples - FileReadTool: file_path → REQUIRED with absolute path example - FileEditTool/types.ts: file_path, old_string, new_string → REQUIRED - GlobTool: pattern → REQUIRED with glob examples - GrepTool: pattern → REQUIRED with regex examples - WebFetchTool: url + prompt → REQUIRED with examples - WebSearchTool: query → REQUIRED with examples - FileWriteTool: file_path + content → REQUIRED (already committed)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
When using OpenClaude with GPT-5/Codex backends, tool calls fail with missing required parameters:
```
InputValidationError: Skill failed due to the following issue:
The required parameter `skill` is missing
InputValidationError: Agent tool failed due to the following issue:
The required parameter `prompt` is missing
InputValidationError: Bash tool failed due to the following issue:
The required parameter `command` is missing
```
Root Cause
OpenAI/GPT-5 function calling relies heavily on the JSON schema `description` field to decide whether to pass a parameter. Without explicit REQUIRED markers and concrete input→output examples, GPT-5 omits required string parameters even when they are listed in the JSON Schema `required` array.
Fix
Added `REQUIRED. ... never omit it.` language and concrete examples to every required string parameter across all affected tools:
Also added explicit GPT-5 instructions to
SkillTool/prompt.ts:```
IMPORTANT for OpenAI/GPT function calling:
```
Impact
Testing
Validated by running OpenClaude with
codexspark(GPT-5.3) and confirming:/commit→Skill({skill: "commit"})✅description+promptpresent ✅🤖 Generated with Claude Code